public class S21 {
    class Solution {
        public int dayOfYear(String date) {
            String[] split = date.split("-");
            int year = Integer.valueOf(split[0]);
            int month = Integer.parseInt(split[1]);
            int day = Integer.parseInt(split[2]);
            int[] days = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
            if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
                days[1] = 29;
            }
            int sum = 0;
            for (int i = 1; i < month; i++) {
                sum += days[i];
            }
            sum += day;
            return sum;
        }
    }
}
